<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>卫戍区东城第四干休所派车管理系统</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="static/css/font.css">
    <link rel="stylesheet" href="static/css/login.css">
    <link rel="stylesheet" href="static/css/xadmin.css">
    <<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="static/lib/layui/layui.js"></script>
    <script src="static/js/jquery.min.js"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body class="login-bg">

    <div class="login layui-anim layui-anim-up">
        <div class="message">管理登录</div>
        <div id="darkbannerwrap"></div>

        <form class="layui-form" >
            <input id="username" name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input id="password" name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录"  style="width:100%;" type="button" id="login">
            <hr class="hr20" >
        </form>
    </div>
    <script type="text/javascript">
        $(function (){
            $("#login").click(function(){
                // 确定url，即提交到的处理地址
                var url = "/user/index";
                // 获取请求参数
                var username = $("#username").val();
                var password = $("#password").val();
                // 确定提交的参数
                var data = "userName=" + username
                    + "&passWord=" + password;
                // 提交并处理ajax异步请求
                $.ajax({
                    "url": url,
                    "data": data,
                    "type": "POST",
                    "dataType": "json",
                    "success": function(obj) {
                        if (obj.code===20000) {
                           location.href = "/toIndex";
                        } else {
                            alert(obj.message);
                        }
                    }
                });
            });
        })
    </script>
</body>
</html>
